<template>
  <div class="data-upload-error-wrapper">
    <div class="error-wrapper">
      <div class="error-message">
        <span><i class="iconfont icon-error-o"></i><span class="error-message-tip">{{msgTips.tips[0] || `上传失败，未知错误`}}</span></span>
      </div>
      <g-button class="btn" type="primary" @click="reUpload">重新上传</g-button>
      <g-button class="btn" type="default" @click="confirm">确定</g-button>
    </div>
  </div>
</template>

<script>
  import GButton from '@/components/common/g-button';
  import Bus from '../../utils/event_bus';

  export default {
    name: 'data-upload-error',
    components: {
      'g-button': GButton
    },
    props: {
      msgTips: {
        type: Object,
        default: {
          msg: '上传出错',
          tips: ['请联系客服咨询']
        }
      }
    },

    methods: {
      reUpload() {
        Bus.$emit('re-upload-after-error');
      },
      concatWrapperShow() {
        _MEIQIA('showPanel');
      },
      confirm() {
        Bus.$emit('close-upload-panel');
      }
    }

  }

</script>

<style lang="scss">
  @import "common";

  .data-upload-error-wrapper {
    height: 100%;
    width: 100%;
    padding: 24px;
    position: relative;

    .error-wrapper {
      // position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      margin: auto;
      height: 176px;
      width: 577.917px;
      text-align: center;
      background-color: #f4f8fb;
      border: 1px dashed #bbb;
      border-radius: 3px;
      margin-top: 116px;

      .btn {
        margin-left: 10px;
      }

      .error-message {
        margin: 40px auto 20px auto;

        >span {
          display: inline-flex;

          >i {
            color: red;
            margin: 0 4px;
          }

          .error-message-tip {
            display: inline-block;
            max-width: 400px;
            max-height: 60px;
            overflow: auto;
            text-align: left;
            line-height: 16px;
          }
        }
      }
    }


    .error-tips {

      margin: 48px;
      padding: 32px 0 0 12px;
      text-align: center;

      ul {
        padding-left: 12px;

        li {
          list-style-type: circle;
          color: $gray;
        }
      }

      >div {
        padding: 4px 0;
        line-height: 22px;
        position: relative;
        margin-left: 28px;
      }

      a {
        color: #20A0FF;
      }

      .dot {
        display: inline-block;
        width: 4px;
        height: 4px;
        border-radius: 2px;
        background-color: grey;
        position: absolute;
        top: 14px;
        left: -24px;
      }

    }

    .re-upload-wrapper {
      position: absolute;
      right: 24px;
      bottom: 24px;
    }
  }

</style>
